package com.leeon.thread;

public class LifeOff implements Runnable{
	
	protected int countDown = 10;
	private static int threadCounts = 0;
	private final int id = threadCounts++;
	public  LifeOff() {
	}
	public LifeOff(int countDown) {
		this.countDown = countDown;
	}
	
	public String status() {
		return "#" + id + "#(" + (countDown > 0 ? countDown : "liftoff!")  +")."; 
	}

	@Override
	public void run() {
		while(countDown-- > 0) {
			System.out.print(status());
			Thread.yield();
		}
	}
	
}
